package com.example.moduletwo.activity;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.ListView;

import com.example.baselibrary.activity.BaseNewActivity;
import com.example.baselibrary.bean.PublicViewHolder;
import com.example.moduletwo.R;
import com.example.moduletwo.adapter.TestAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by sun.li on 2018/6/6.
 *
 * @author sun.li
 */

public class ModuleTwoMVPActivityListView extends BaseNewActivity {

    private TestAdapter testAdapter;

    private List<String> list;

    private Context mContext;

    @Override
    protected int initLayoutRes() {
        return R.layout.activity_mvp_listview;
    }

    @Override
    protected PublicViewHolder initViewHolderObject() {
        return null;
    }

    @Override
    protected void baseOnClick(int viewId) {

    }

    @Override
    protected void initView(@Nullable Bundle bundle) {
        super.initView(bundle);
        mContext = this;
        list = new ArrayList<>();
        for (int i = 0; i < 50; i++) {
            list.add("item_"+i);
        }
        testAdapter = new TestAdapter(mContext,list);

        ListView lv_aml_listview = findViewById(R.id.lv_aml_listview);
        lv_aml_listview.setAdapter(testAdapter);


//        lv_aml_listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
//            @Override
//            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//                if(null!=testAdapter.getData()){
//                    String str = testAdapter.getData().get(position);
//                    LKToastUtil.showToastShort(str);
////                    viewDelegate.setText(str+"_"+v.getId());
//                    testAdapter.getData().set(position,str+"_"+id);
//                    testAdapter.notifyDataSetChanged();
//                }
//            }
//        });
    }
}
